import { request } from '@/service/request';
import { SysDictType } from "@/views/system/dict/dict-type/index";

export function fetchType(id: Common.IdType) {
  return request({
    url: `/system/type/${id}`,
    method: 'GET',
  });
}

export function fetchTypePage(page: Common.Page<SysDictType>, searchData: any) {
  return request({
    url: '/system/type/list',
    data: { page, searchData },
    method: 'POST',
  });
}

export function fetchTypeList(searchData: any) {
  return request({
    url: '/system/type/listFull',
    data: searchData,
    method: 'POST',
  });
}

export function fetchAddType(data: SysDictType) {
  return request({
    url: '/system/type/',
    data: data,
    method: 'POST',
  });
}

export function fetchUpdateType(data: SysDictType) {
  return request({
    url: '/system/type/',
    data: data,
    method: 'PUT',
  });
}

export function fetchDelType(ids: Common.IdType[]) {
  // 假设服务器端期望接收逗号分隔的 ID 字符串
  return request({
    url: `/system/type/${ids}`,
    method: 'DELETE',
  });
}
